<?php getView('modules/header'); ?>
	<div class="container">
		<div class="row">
			<div class="col-xs-10 col-xs-offset-1 col-sm-4 col-sm-offset-4">
				<a href="<?php echo base_url(); ?>" class="logo-login">
					<img src="<?php echo site_url('public/admin/images/wordpress-logo.svg'); ?>" alt="" class="img-responsive">
				</a>
			</div>
		</div>
		<div class="row">
			<div class="col-xs-12 col-sm-4 col-sm-offset-4">
				<?php 
				$attr = array('class' => 'form', 'id' => 'form-signup');
				echo form_open('admin/signup/checksignup', $attr);
				?>
					<h2 class="text-center">Sign Up</h2>
					<div class="form--group">
						<label for="username">Username</label>
						<input id="username" type="text" name="username" class="form-control">
					</div>
					<div class="form-group">
						<label for="email">Email</label>
						<input id="email" type="email" name="email" class="form-control">
					</div>
					<div class="form-group">
						<p>A password will be e-mailed to you.</p>
					</div>
					<div class="form-group">
						<input type="submit" name="login-submit" id="signup-submit" value="Sign Up" class="form-control btn btn-primary">
					</div>
					<div class="form-group">
						<p class="success"></p>
						<p class="error"></p>
					</div>
					<div class="form-group">
						<a href="<?php echo site_url('admin/login'); ?>" id="login">Login</a>
					</div>
				</form>
			</div>
		</div>
	</div>
<script>
	$(function(){
		// ---------------------------- Validate
		$('#form-signup').validate({
			rules:{
				username: 'required',
				email: 'required'
			},
			messages:{
				username: "Enter your username",
				email: "Enter your email",
			}
		});

		// ----------------------------- Form submit
		$('#form-signup').submit(function(){
			if($('#form-signup').valid()){
				$.post($('#form-signup').attr('action'), $('#form-signup').serializeArray(), function(json){
					if(json.status == 0){
						showHide(json.message, 3000, 'p.error');
					}else{
						showHide(json.message, 5000, 'p.success');
					}
				}, 'json');
			}
			return false;
		});
	});
</script>	
</body>
</html>